#pragma once

#include <sstream>
#include <map>
#include "zakengine/zak.h"
#include "basegameentity.h"
#include <string>

using namespace zak;

// List of entities
enum 
{
	ent_Peon,
	ent_GoldMine,
	ent_TownHall,
};

/*-------------------------------------------------------------------------------------------------------------*/
inline std::string GetEntityName(int iID)
{
	switch(iID)
	{
	case ent_Peon:

		return "Peon";

	case ent_GoldMine:

		return "GoldMine"; 

	default:

		return "UNKNOWN!";
	}
}

/*-------------------------------------------------------------------------------------------------------------*/
class BaseGameEntity;

class EntityManager 
{
public:
	
	// Singleton
	static EntityManager*					Instance();

	// Register Entity
	void									RegisterEntity(BaseGameEntity* pNewEntity);

	// Returns pointer to entity matching the ID
	BaseGameEntity*							GetEntityByID(int iID)const;

	// Unregister Entity
	void									RemoveEntity(BaseGameEntity* pEntity);

private:
	
	// Typedef of map
	typedef std::map<int, BaseGameEntity*>	EntityMap;

	// Map used to facilitate entity lookup
	EntityMap								m_entityMap;

	// Class constructor
	EntityManager(){}

	// Copy and Assignment Constructors
	EntityManager(const EntityManager&);
	EntityManager& operator=(const EntityManager&);
};